<template>
  <div class="refund">
    <div class="card">
      <div class="label">周庄古镇(成人票)</div>
      <van-cell-group :border="false">
        <van-cell title="总数量:" :value="`${total}张`" value-class="value" title-class="title" />
        <van-cell title="退款数量:" title-class="title">
          <div class="field-wrap">
            <img class="cut" src="@/assets/cut.png" alt srcset @click="cut" />
            <van-field v-model="count" type="digit" :border="false" class="refund-input"/>
            <img class="plus" src="@/assets/plus.png" alt srcset @click="plus" />
          </div>
        </van-cell>
        <van-cell title="退款金额:" :value="`¥${price}`" value-class="value red" title-class="title" />
      </van-cell-group>
    </div>
    <div class="card m-t-10">
      <div class="label">取消原因</div>
      <van-radio-group v-model="radio">
        <van-cell-group>
          <van-cell title="行政不确定" clickable @click="selectReason('1')" title-class="title">
            <van-radio slot="right-icon" name="1">
              <img
                class="radio-icon"
                slot="icon"
                slot-scope="props"
                :src="props.checked ? activeIcon : inactiveIcon"
              />
            </van-radio>
          </van-cell>
          <van-cell title="商家/景区原因" clickable @click="selectReason('2')" title-class="title">
            <van-radio slot="right-icon" name="2">
              <img
                class="radio-icon"
                slot="icon"
                slot-scope="props"
                :src="props.checked ? activeIcon : inactiveIcon"
              />
            </van-radio>
          </van-cell>
          <van-cell title="其他原因" clickable @click="selectReason('3')" title-class="title">
            <van-radio slot="right-icon" name="3">
              <img
                class="radio-icon"
                slot="icon"
                slot-scope="props"
                :src="props.checked ? activeIcon : inactiveIcon"
              />
            </van-radio>
          </van-cell>
        </van-cell-group>
      </van-radio-group>
    </div>
    <button type="button" class="btn">申请退款</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      total: 10,
      count: 1,
      price: 69,
      radio: "1",
      activeIcon: require("@/assets/user-active.png"),
      inactiveIcon: require("@/assets/user-inactive.png")
    };
  },
  methods: {
    selectReason(index) {
      this.radio = index;
    },
    //增加
    plus() {
      this.count++;
    },
    //减少
    cut() {
      if (this.count == 0) return;
      this.count--;
    }
  }
};
</script>

<style lang="scss" scoped>
.refund {
  padding: 15px;
  .card {
    height: 218px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px 1px 12px 0px rgba(205, 203, 203, 0.34);
    border-radius: 5px;
    .label {
      padding: 0 12px;
      font-size: 15px;
      line-height: 38px;
      color: #1e1d1d;
      font-weight: bold;
    }
    .van-cell {
      padding: 14px 10px 15px;
    }
    .title {
      line-height: 31px;
      color: #666;
    }
    .value {
      line-height: 31px;
      color: #333;
      &.red {
        color: #f18181;
      }
    }
    /deep/.van-radio__icon {
      line-height: 24px;
    }
    .radio-icon {
      width: 17px;
      height: 17px;
    }
    .field-wrap {
      width: 136px;
      display: flex;
      margin-left: auto;
      img {
        width: 31px;
        height: 31px;
      }
      .refund-input {
        margin: 0 12px;
        width: 50px;
        padding: 0;
        border: 1px solid #ddd;
        border-radius: 5px;
        /deep/input {
          height: 29px;
          font-size: 17px;
          text-align: center;
          color: #262626;
        }
      }
    }
  }
  .btn {
    margin-top: 44px;
    width: 343px;
    height: 45px;
    border: none;
    background: linear-gradient(
      267deg,
      rgba(255, 69, 69, 1),
      rgba(252, 127, 118, 1)
    );
    color: #fff;
    box-shadow: 0px 1px 8px 0px rgba(255, 164, 164, 1);
    border-radius: 23px;
  }
}
</style>